Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major change: Rework namespace (get rid of ::config namespace again) #950

Merged
merged 1 commit into from
Nov 4, 2016
Merged

Major change: Rework namespace (get rid of ::config namespace again) #950

merged 1 commit into from
Nov 4, 2016

Conversation

wyardley
Copy link
Collaborator

@wyardley wyardley commented Oct 27, 2016

Not sure how this should be accomplished, but would welcome some input, here's my first pass at restructuring things.

A few questions:

  1. Should params be pulled in in init, then passed to config, or should config take things that come from params directly? The problem is, we want users to be able to override most params, so I think most of them should be set in init, then passed to config.
  2. Should config reference everything at top scope ($::nginx::foo)? The params used directly in config.pp are not many, but all the configs generated by templates are also in the config namespace. Having inherits ::nginx doesn't seem to make a difference here.

I thought templates would always take @foo from the top level namespace of the module, but with these changes, I'm getting some errors (see below).

I think most of these changes will break or cause unpredictable behavior when people set nginx::config::foo in hiera... thoughts on how to warn on this or keep backwards compatibility

@wyardley
Copy link
Collaborator Author

Pinging @danzilio and @bastelfreak again

@wyardley wyardley mentioned this pull request Oct 28, 2016
@wyardley
Copy link
Collaborator Author

wyardley commented Nov 3, 2016

Spoke with @hunner, @bmjen and others about this in the modules meeting, and got some recommendations about how this should proceed.

@wyardley
Copy link
Collaborator Author

wyardley commented Nov 3, 2016

After community modules review, went in the direction that modules team is recommending as current best practice. This is pretty big and nasty, so would appreciate some eyes to make sure I didn't massively screw something up, though I am sure there will need to be some more improvements.

This will definitely be a breaking change and a big 180; the nginx::config namespace won't be exposed.

I'm not quite sure how the config class was getting Debian / Ubuntu type defaults before in the 'with defaults' context; I changed tests in that scope to the actual daemon_owner that are the default in params.pp, but could especially use a look at LL 341-347 in spec/classes/nginx_spec.rb.

service and package still are private classes, but are not yet quite following the same convention, but want to tackle that separately if / after this gets merged.

Followed @danzilio's first suggestion about the specs (which @hunner agreed with), namely, including all the private classes in the main class spec. For now, I still left the private classes in their own contexts.

Class spec is now passing, but still need to work on the other failing tests.

@wyardley wyardley changed the title [WIP] Major change: Rework namespace (get rid of ::config namespace again) Major change: Rework namespace (get rid of ::config namespace again) Nov 3, 2016
@wyardley
Copy link
Collaborator Author

wyardley commented Nov 4, 2016

Also pulled out the redundant validations in config.pp

@wyardley wyardley closed this Nov 4, 2016
@wyardley wyardley reopened this Nov 4, 2016
@@ -247,12 +139,12 @@
File["${conf_dir}/conf.d"] {
purge => true,
recurse => true,
notify => Class['::nginx::service'],
notify => Class['service'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious, why did you remove the ::nginx?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good question. To be honest, I think that's the result of an overzealous sed command or search / replace!

Updated and pushed, thanks for catching that.

@wyardley
Copy link
Collaborator Author

wyardley commented Nov 4, 2016

ps - I'll do a rebase too

@zachfi
Copy link
Contributor

zachfi commented Nov 4, 2016

This seems like a good change to make here, but why? I'm on a version of the module (in one of my environments) where setting values on the nginx class throws deprecation warnings and says set things on nginx::config. Are we thinking now that nginx::config was the wrong move?

Fwiw, this also should make it simpler to migrate that data to puppet4 native hiera if we wanted.

@bastelfreak
Copy link
Member

@xaque208 we figured out that throwing the warning doesn't meet the current best practices so we are removing it.

@bastelfreak bastelfreak merged commit 471ae97 into voxpupuli:master Nov 4, 2016
@zachfi
Copy link
Contributor

zachfi commented Nov 7, 2016

Makes sense, thanks @bastelfreak.

@wyardley wyardley added this to the 1.0 milestone Dec 5, 2016
Rubueno pushed a commit to Rubueno/puppet-nginx that referenced this pull request Oct 19, 2020
Major change: Rework namespace (get rid of ::config namespace again)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants